/**
 * Created by Administrator on 2015/3/15.
 */
angular.module('layoutCtrl', ['layoutService','ngCookies','ui.router'])
    .controller('baseCtrl', ['$scope','$cookieStore', function ($scope,$cookieStore) {
        $scope.nav = {};//导航所有属性存放容器
        if($cookieStore.get('navInfo')){
            $scope.nav = $cookieStore.get('navInfo') ;
        }
    }])
    .controller('userAdd', ['$scope','post','$state','$stateParams', function ($scope,post,$state,$stateParams) {
        console.log($stateParams.id);
        $scope.save = function(){
            post($scope.user,ROOT + '/hr/home/public/test',function(res){
                if(res)  $state.go('/.user');
            });
        }
    }])
    .controller('setSystem',['$scope','post','gets','$state', function ($scope,post,gets,$state) {
        gets('./data/system.json',function(res){
            if(res) $scope.app = res ;
        });
        $scope.$watch('app.isClosed',function(newValue,oldValue){
            if(newValue==false)  $scope.app.colsed = '' ;
        });
        $scope.save = function(){
            post($scope.user,ROOT + '/hr/home/public/test',function(res){
                if(res) $state.go('/user');
            });
        }
    }]);
